package cn.stylefeng.guns.modular.business.frequency.settlementbargain.controller;

import cn.stylefeng.guns.core.annotion.BusinessLog;
import cn.stylefeng.guns.core.enums.LogAnnotionOpTypeEnum;
import cn.stylefeng.guns.core.pojo.response.ResponseData;
import cn.stylefeng.guns.core.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import cn.stylefeng.guns.modular.business.frequency.settlementbargain.service.SettlementBargainService;
import cn.stylefeng.guns.modular.business.frequency.settlementbargain.model.param.SettlementBargainParam;

import javax.annotation.Resource;

/**
 * 结算人列表 控制器
 *
 * @author: yujie
 * @date: 2023/05/27 16:38
 */
@RestController
public class SettlementBargainController {

    @Resource
    private SettlementBargainService settlementBargainService;

    /**
     * 分页查询结算人列表
     *
     * @author yujie
     * @date 2023/05/27 16:38
     */
    @GetMapping("/settlementBargain/page")
    @BusinessLog(title = "结算人列表_分页查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData page(SettlementBargainParam settlementBargainParam) {
        return ResponseData.andaSuccess(settlementBargainService.page(settlementBargainParam));
    }

    /**
     * 获取全部结算人列表
     *
     * @author yujie
     * @date 2023/05/27 16:38
     */
    @GetMapping("/settlementBargain/list")
    @BusinessLog(title = "结算人列表_查询所有", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData list(SettlementBargainParam settlementBargainParam) {
        return ResponseData.andaSuccess(settlementBargainService.list(settlementBargainParam));
    }

    /**
     * 查看详情结算人列表
     *
     * @author yujie
     * @date 2023/05/27 16:38
     */
    @GetMapping("/settlementBargain/detail")
    @BusinessLog(title = "结算人列表_查看详情", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData detail(@Validated(SettlementBargainParam.detail.class) SettlementBargainParam settlementBargainParam) {
        return new SuccessResponseData(settlementBargainService.detail(settlementBargainParam));
    }

    /**
     * 添加结算人列表
     *
     * @author yujie
     * @date 2023/05/27 16:38
     */
    @PostMapping("/settlementBargain/add")
    @BusinessLog(title = "结算人列表_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public ResponseData add(@RequestBody @Validated(SettlementBargainParam.add.class) SettlementBargainParam settlementBargainParam) {
        settlementBargainService.add(settlementBargainParam);
        return new SuccessResponseData();
    }

    /**
     * 删除结算人列表
     *
     * @author yujie
     * @date 2023/05/27 16:38
     */
    @PostMapping("/settlementBargain/delete")
    @BusinessLog(title = "结算人列表_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public ResponseData delete(@RequestBody @Validated(SettlementBargainParam.delete.class) SettlementBargainParam settlementBargainParam) {
        settlementBargainService.delete(settlementBargainParam);
        return new SuccessResponseData();
    }

    /**
     * 编辑结算人列表
     *
     * @author yujie
     * @date 2023/05/27 16:38
     */
    @PostMapping("/settlementBargain/edit")
    @BusinessLog(title = "结算人列表_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public ResponseData edit(@RequestBody @Validated(SettlementBargainParam.edit.class) SettlementBargainParam settlementBargainParam) {
        settlementBargainService.edit(settlementBargainParam);
        return new SuccessResponseData();
    }


}
